<?php

namespace App;

use Illuminate\Database\Eloquent\Model;

class Post extends Model
{
    /**
     * 属于的模型
     */
    public function category()
    {
        return $this->belongsTo('App\Category');
    }

    /**
     * 标签列表
     */
    public function tag()
    {
        return $this->belongsToMany('App\Tag');
    }

    /**
     * 关联评论
     */
    public function comment()
    {
        return $this->hasMany('App\Comment');
    }
}
